package com.yanfan.energy.domain;

import com.yanfan.common.core.domain.entity.SysDept;
import com.yanfan.common.core.domain.entity.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * 单价设置历史记录表(EnergyPriceHistory)实体类
 *
 * @author makejava
 * @since 2022-09-28 11:19:20
 */
public class EnergyPriceHistory implements Serializable {
    private static final long serialVersionUID = -33481138542784216L;
    /**
     * 主键
     */
    private Integer id;
    /**
     * 单价设置id
     */
    private Integer priceSettingId;
    /**
     * 用户编号
     */
    private Integer userId;
    /**
     * 设置对象
     */
    private Integer unitTargetBefore;
    /**
     * 设置前单价
     */
    private Double unitPriceBefore;
    /**
     * 设置后单价
     */
    private Double unitPriceAfter;
    /**
     * 创建人
     */
    private String createdBy;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createdDate;
    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date lastModifiedDate;
    /**
     * 能源单价
     */
    private Double price;
    /**
     * 能源类型
     */
    private Integer type;
    /**
     * 开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;
    /**
     * 结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;
    /**
     * 用户实体
     *
     * @author caijinkang
     * @date 2022/9/28 11:36
     * @param null
     * @return null
     */
    private SysUser sysUser;
    /**
     * 用户部门
     *
     * @author caijinkang
     * @date 2022/9/28 14:29
     * @param null
     * @return null
     */
    private SysDept sysDept;
    /**
     * 能源名称
     *
     * @author caijinkang
     * @date 2022/10/13 14:20
     * @return java.lang.Integer
     */
    private String name;

    private Integer scheme;


    public EnergyPriceHistory() {
    }

    public EnergyPriceHistory(Integer id, Integer priceSettingId, Integer userId, Integer unitTargetBefore, Double unitPriceBefore, Double unitPriceAfter, String createdBy, Date createdDate, Date lastModifiedDate, Double price, Integer type, Date startTime, Date endTime, SysUser sysUser, SysDept sysDept, String name) {
        this.id = id;
        this.priceSettingId = priceSettingId;
        this.userId = userId;
        this.unitTargetBefore = unitTargetBefore;
        this.unitPriceBefore = unitPriceBefore;
        this.unitPriceAfter = unitPriceAfter;
        this.createdBy = createdBy;
        this.createdDate = createdDate;
        this.lastModifiedDate = lastModifiedDate;
        this.price = price;
        this.type = type;
        this.startTime = startTime;
        this.endTime = endTime;
        this.sysUser = sysUser;
        this.sysDept = sysDept;
        this.name = name;
    }

    public EnergyPriceHistory(Integer id, Integer priceSettingId, Integer userId, Integer unitTargetBefore, Double unitPriceBefore, Double unitPriceAfter, String createdBy, Date createdDate, Date lastModifiedDate, Double price, Integer type, Date startTime, Date endTime, Integer scheme) {
        this.id = id;
        this.priceSettingId = priceSettingId;
        this.userId = userId;
        this.unitTargetBefore = unitTargetBefore;
        this.unitPriceBefore = unitPriceBefore;
        this.unitPriceAfter = unitPriceAfter;
        this.createdBy = createdBy;
        this.createdDate = createdDate;
        this.lastModifiedDate = lastModifiedDate;
        this.price = price;
        this.type = type;
        this.startTime = startTime;
        this.endTime = endTime;
        this.scheme = scheme;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPriceSettingId() {
        return priceSettingId;
    }

    public void setPriceSettingId(Integer priceSettingId) {
        this.priceSettingId = priceSettingId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getUnitTargetBefore() {
        return unitTargetBefore;
    }

    public void setUnitTargetBefore(Integer unitTargetBefore) {
        this.unitTargetBefore = unitTargetBefore;
    }

    public Double getUnitPriceBefore() {
        return unitPriceBefore;
    }

    public void setUnitPriceBefore(Double unitPriceBefore) {
        this.unitPriceBefore = unitPriceBefore;
    }

    public Double getUnitPriceAfter() {
        return unitPriceAfter;
    }

    public void setUnitPriceAfter(Double unitPriceAfter) {
        this.unitPriceAfter = unitPriceAfter;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public Date getLastModifiedDate() {
        return lastModifiedDate;
    }

    public void setLastModifiedDate(Date lastModifiedDate) {
        this.lastModifiedDate = lastModifiedDate;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public SysDept getSysDept() {
        return sysDept;
    }

    public void setSysDept(SysDept sysDept) {
        this.sysDept = sysDept;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Integer getScheme() {
        return scheme;
    }

    public void setScheme(Integer scheme) {
        this.scheme = scheme;
    }

    @Override
    public String toString() {
        return "EnergyPriceHistory{" + "id=" + id + ", priceSettingId=" + priceSettingId + ", userId=" + userId + ", unitTargetBefore=" + unitTargetBefore + ", unitPriceBefore=" + unitPriceBefore + ", unitPriceAfter=" + unitPriceAfter + ", createdBy='" + createdBy + '\'' + ", createdDate=" + createdDate + ", lastModifiedDate=" + lastModifiedDate + ", price=" + price + ", type=" + type + ", startTime=" + startTime + ", endTime=" + endTime + ", sysUser=" + sysUser + ", sysDept=" + sysDept + ", name='" + name + '\'' + '}';
    }


    public static class Type {
        public static final Item COOLINGTYPE = new Item(1, "coolingType", "冷却水");
        public static final Item SOFTENINGTYPE = new Item(2, "softeningType", "软化水");
        public static final Item TAPTYPE = new Item(3, "tapType", "自来水");
        public static final Item COMPRESSEDAIR = new Item(4, "compressedAir", "压缩空气");
        public static final Item NATURALGAS = new Item(5, "naturalGas", "燃气");
        public static final Item STEAM = new Item(6, "steam", "蒸汽");
        public static final Item SPIKESPRICE = new Item(7, "spikesPrice", "尖电");
        public static final Item PEAKSPRICE = new Item(8, "peaksPrice", "峰电");
        public static final Item PARITYPRICE = new Item(9, "parityPrice", "平电");
        public static final Item LOWEBBPRICE = new Item(10, "lowEbbPrice", "谷电");
        public static final Item AIRHEAT = new Item(11, "airHeat", "压缩空气");
        public static final Item COOLCAPACITY = new Item(12, "coolCapacity", "冷量");
        public static final Item HEATCAPACITY = new Item(13, "heatCapacity", "热量");

        public static Item getByCode(Integer code) {
            if (Objects.equals(code, COOLINGTYPE.getCode())) {
                return COOLINGTYPE;
            } else if (Objects.equals(code, SOFTENINGTYPE.getCode())) {
                return SOFTENINGTYPE;
            } else if (Objects.equals(code, TAPTYPE.getCode())) {
                return TAPTYPE;
            } else if (Objects.equals(code, COMPRESSEDAIR.getCode())) {
                return COMPRESSEDAIR;
            } else if (Objects.equals(code, NATURALGAS.getCode())) {
                return NATURALGAS;
            } else if (Objects.equals(code, STEAM.getCode())) {
                return STEAM;
            } else if (Objects.equals(code, SPIKESPRICE.getCode())) {
                return SPIKESPRICE;
            } else if (Objects.equals(code, PEAKSPRICE.getCode())) {
                return PEAKSPRICE;
            } else if (Objects.equals(code, PARITYPRICE.getCode())) {
                return PARITYPRICE;
            } else if (Objects.equals(code, LOWEBBPRICE.getCode())) {
                return LOWEBBPRICE;
            } else if (Objects.equals(code, AIRHEAT.getCode())) {
                return AIRHEAT;
            } else if (Objects.equals(code, COOLCAPACITY.getCode())) {
                return COOLCAPACITY;
            } else if (Objects.equals(code, HEATCAPACITY.getCode())) {
                return HEATCAPACITY;
            }
            return null;
        }

        @Getter
        @Setter
        @AllArgsConstructor
        @NoArgsConstructor
        public static class Item {
            private Integer code;
            private String value;
            private String name;

        }
    }
}

